using System;
using System.Text;
using System.Configuration;
using System.Collections.Generic;

namespace ACSeguridad
{
    public class dbConexion
    {
        #region Variables
        private static string m_usuario;
        private static string m_servidor;
        private static string m_basedatos;
        private static string m_userid;
        private static string m_password;

        #endregion

        #region Contructores
        public dbConexion() { }
        public dbConexion(string x_usuario, string x_servidor, string x_basedatos, string x_userid, string x_password)
        {
            m_userid = x_userid;
            m_usuario = x_usuario;
            m_servidor = x_servidor;
            m_basedatos = x_basedatos;
            m_userid = x_userid;
            m_password = x_password;
        }
        public dbConexion(ACDataConexion _dc)
        {
            m_userid = _dc.UsuarioBD;
            m_usuario = _dc.UsuarioBD;
            m_servidor = _dc.Servidor;
            m_basedatos = _dc.BaseDatos;
            m_password = _dc.PasswordBD;
            //m_algorithm = 
        }
        #endregion

        #region Conexion a la Base de Datos
        private void conexion()
        {
            //try
            //{
            //    ConnectionStringSettings conn = new ConnectionStringSettings("strConnn", "Server=" + m_servidor + ";DataBase=" + m_basedatos + ";User Id=" + m_userid + ";Pwd=" + m_password + ";", "System.Data.SqlClient");

            //    Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            //    config.ConnectionStrings.ConnectionStrings.Add(conn);
            //    config.Save(ConfigurationSaveMode.Modified);
            //    ConfigurationManager.RefreshSection("connectionStrings");


                
            //    //ConfigurationManager.ConnectionStrings.Add(conn);

            //    sql.Instanciar("strConnn");
            //}
            //catch (Exception ex)
            //{ throw ex; }
        }
        #endregion
    }
    
}
